Skip to content

Add generic CP model builder and test its use in ARX model#386

Merged
peacker merged 6 commits intodevelopfrom
build_generic_cp_model
Jan 12, 2026
Merged

Add generic CP model builder and test its use in ARX model#386
peacker merged 6 commits intodevelopfrom
build_generic_cp_model

Conversation

@davidGG271
Copy link
Copy Markdown
Collaborator

Summary

This PR introduces a generic builder for CP models that allows constructing a MiniZinc model directly from a list of components and their associated CP constraint generators.

Changes

  • Added build_generic_cp_model_from_dictionary to MznModel, enabling generic construction of CP models from component–model mappings.
  • Added a unit test that validates the new builder using MznXorDifferentialModelARXOptimized.
  • The test applies fixed input/output constraints and solves the resulting CP model to ensure correctness.

Notes

  • The generic builder is model-agnostic and does not assume ARX-specific initialization.
  • ARX-specific constraints (init_constraints) are applied explicitly in the test where required.
  • This keeps the builder reusable for future CP models beyond ARX.

This change improves modularity and reusability of CP model construction, making it easier to extend support for additional CP-based models without duplicating build logic.

Comment thread claasp/cipher_modules/models/cp/mzn_model.py Outdated
Comment thread tests/unit/cipher_modules/models/cp/mzn_model_test.py Outdated
@juaninf juaninf self-requested a review January 7, 2026 04:57
…ic_propagation_constraints and add references for differential and linear test vectors
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jan 8, 2026

@juaninf juaninf requested a review from peacker January 9, 2026 05:32
@peacker peacker merged commit 4023e91 into develop Jan 12, 2026
10 checks passed
@peacker peacker deleted the build_generic_cp_model branch January 12, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants